package cn.tedu.spring2205.week02.beans;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Service
public class ProductService {

    @Autowired
    private AccountDao accountDao;

    //构造注入
//    @Autowired
//    public ProductService(ProductDao productDao){
//        System.err.println("构造注入..."+productDao);
//        System.err.println("字段注入的值："+accountDao);
//    }
    //setter注入
//    @Autowired
//    public void setCustomDao(CustomDao customDao){
//        System.err.println("字段注入的值："+accountDao);
//        System.err.println("setter注入"+customDao);
//    }
    //自定义初始化操作
    @PostConstruct
    public void myInit(){
        System.err.println("调用productService的初始化器执行该方法。。。");
    }

    @PreDestroy
    public void myDes(){
        System.err.println("productService实例销毁之前执行自定义操作。。。。");
    }

}
